# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           wxWidgets 1.0

name                stimfit
version             0.13.9
categories          science
platforms           darwin
license             GPL-2
maintainers         gmx.de:christsc
description         Electrophysiology analysis suite
long_description    A program for viewing and analyzing electrophysiological data
homepage            http://www.stimfit.org
master_sites        http://www.stimfit.org

checksums           rmd160  48ee8ce85e298b0da9afb50906d7f5b7d002fb72 \
                    sha256  e1cd480a5a4eafb4c28e12e644a1ba0f5ff32e43b412e37cb437934f496a6424

wxWidgets.use       wxPython-3.0

depends_lib         port:boost \
                    port:fftw-3 \
                    port:hdf5-18 \
                    port:${wxWidgets.port}

configure.args      --with-wx-config=${wxWidgets.wxconfig} \
                    --disable-dependency-tracking \
                    --disable-python \
                    --without-biosig

# Only Python 2.7 is supported until wxpython gets available for Python 3.x
variant python27 description {Build with Python shell.} {
    depends_build-append \
        port:swig-python

    depends_lib-append \
        port:python27 \
        port:py27-wxpython-3.0 \
        port:py27-numpy \
        port:py27-matplotlib

    configure.python \
        ${prefix}/bin/python2.7

    configure.args-delete \
        --disable-python

    configure.args-append \
        --enable-python
}

variant atlas description {Use MacPorts ATLAS libraries.} {
    depends_lib-append \
        port:atlas

    configure.args-append \
        --with-lapack-lib=${prefix}/lib/libatlas.a
}

variant biosig description {Use biosig library for file I/O.} {
    depends_lib-append \
        port:libbiosig

    configure.args-replace \
        --without-biosig \
        --with-biosig
}

configure.ldflags-append \
                    -headerpad_max_install_names

# Commented out for now; will be required when wxpython gets available for Python 3.x
# if {![variant_isset python27]} { 
default_variants    +python27
# }
default_variants-append \
                    +biosig

destroot.destdir    DESTDIR=${destroot}${applications_dir}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 ${worksrcpath}/debian/copyright \
        ${worksrcpath}/COPYING ${docdir}
}
